﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Remember.WPF.Pages
{
    /// <summary>
    /// Interaction logic for TTS.xaml
    /// </summary>
    public partial class TTS : Window
    {
        System.Speech.Synthesis.SpeechSynthesizer speaker;

        public TTS()
        {
            InitializeComponent();

            speaker = new System.Speech.Synthesis.SpeechSynthesizer();

            if (speaker != null)
            {
                //s.Speak("Hello. My name is Microsoft Anna.");
                speaker.Speak("欢迎进入听说程序");
            }

        }

        private void btnStart_Click(object sender, RoutedEventArgs e)
        {
            if (speaker != null)
            {
                //s.Speak("Hello. My name is Microsoft Anna.");
                speaker.Speak("开始");
                Speck();
            }

        }

        void Speck()
        {
            if (speaker != null)
            {
                //s.Speak("Hello. My name is Microsoft Anna.");
                speaker.Speak( this.textBoxBody.Text  );
            }

        }
    }
}
